package com.googlecode.lookie.swing.iconlist;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import javax.swing.Icon;

public class BufferedImageIcon
    implements Icon
{

    private final BufferedImage _image;

    public BufferedImageIcon( final BufferedImage image )
    {
        _image = image;
    }

    public final void paintIcon( final Component c, final Graphics g, final int x, final int y )
    {
        g.drawImage( _image, x, y, c );
    }

    public final int getIconWidth()
    {
        return _image.getWidth();
    }

    public final int getIconHeight()
    {
        return _image.getHeight();
    }

    public final BufferedImage getImage()
    {
        return _image;
    }

}
